Copyright: A. Koot, 1994
Citation: Copycode helps you too


Index
Copycode index

Loading files

Copying code

Closing Copycode

Using CodeAdvisor

Using CodePrinter

Using Make-Lib

Using Spy:FRX

Using CodeCrosser


Copycode

One problem of VB is that you can only open one project at a time. If (like me) you have a lot of projects with great functions that you would like to use in a new project, there is always the possibility of adding the source file that contains the source you need. That would, however, leave you with a lot of unneeded functions. And this works only if you don't already have a duplicate procedure name in the project.

Well, ok, you could try Notepad, or MS-Write, but that would leave you with a lot of unstructured and unneeded code (your forms descriptions). Notepad can also only edit 32Kb, not enough for the more complicated forms files.

Copycode comes to your rescue. It allows you to open a second project next to your VB environment. From this new Copycode environment you can search your code (find all procedures file by file, or do a global search of your project) and copy all code you need.

And it can show you which of the procedures in your project are not needed anyway in order to optimize your project.


CodeAdvisor

Optimizing your source code

The advantage of reusing sourcecode from existing projects (by using existing forms or modules) is that you do not need to do a lot of extra work. The disadvantage is that you could end up with a lot of code you actually do not need. So, CodeAdvisor was built for you.

What it does?

Not very much. It just reads your code and checks for procedures, constants and declarations that are never actually called in your code. When it finds these, CodeAdvisor creates a report on screen, mentioning all these procedures, constants and declarations. CodeAdvisor never touches your code!

You can save the report (as an Ascii-file) by pressing Menu File-Save CodeAdvisor Info.

CodeAdvisor doesn't look for procedures with an Underscore character (it might be an custom event not known by Copycode or myself for that matter).

If CodeAdvisor finds an obsolete procedure and you decide to delete it, I advise you to rerun CodeAdvisor: there could be constants or calls to procedures that are no longer present in your project after deleting the procedure.

Before actually deleting anything, be sure to make a back-up of your project. I tested this function, but I will not accept any claims for lost code...

You can find CodeAdvisor after loading a Project. It is situated in the Options menu. I even created this nice button [image] for it.

See also: Problems


CodePrint

Printing your source code

CodePrinter is new in release 4.0. This function enables you to get a hard copy of the source code of the project you opened in Copycode. CodePrinter can be found in the Options menu.

There is not much to be done: just answer Yes when asked and then wait and see.

Codeprinter formats your text in a simple, but efficient way: Every Module or Form is printed on a new page. Procedures and functions are printed in a bold typeface. There is no way (yet) to add a personal touch.

After printing the final page of source code CodePrinter prints an alphabetical summary of all procedures and functions, with the module name and pagenumber where each procedures is printed.

CodePrinter seems to work okay, but there is a problem when a procedures encounters a pagebreak. This is not handled in a good looking way. I may clean it up in a future release.

Also be ware of the amount of paper needed:

sample project# 	1	2	3

source size (by Copycode)	6150	75839	204133

forms and modules	1	14	19

number of pages	5	66	152

(page size 11")


MakeLib

Create a personal VB library

After using Copycode for some time, I found that I still needed to load several projects that contain usefull procedures. So I decided to add the Make-Lib option. You can use it in this manner:

Highlight a procedure in the right-hand listbox (the regular, not control-bound one).

Press the right hand mouse button and choose the To-Library option.

That's all folks.

To save your library, choose the Save library option beyond the File menu.

To reload the library: Open Library.

Note: This is the first release. After loading a library: DO NOT choose CodeAdvisor, that would result in loads of unneeded code (depending on your library size).


SpyFrx

Copying Graphics files data

When all VB-forms are saved as Ascii, VB creates FRX files, that contain the graphics information from the forms. This includes the Forms-Icon and all icons and bitmaps in Picturebox controls and Image controls. By using the Spy:FRX functions it is possible to read these graphics.

After opening an FRX file, Copycode reads the file and displays the information in the two listboxes in the main window. The lefthand listbox shows all BMP's and WMF's. The righthand listbox shows all Icons within the FRX file. The names shown are fictional.

By choosing one of these graphics names, the relevant graphic is shown.

At this time you can choose to:

copy a BMP or WMF to clipboard (by pressing the Copy-button or Menu Edit-Copy)

save a BMP (choose from the File menu the Save Bitmap option)

save an icon (choose from the File menu the Save Icon option)

After using Copycode in the Spy:FRX mode you have to close the Spy:FRX window to continue using CopyCode in the Copycode mode.


Cross Reference

CodeCrosser is new in release 4.3. It enables you to create a cross reference of the procedures and functions in your project.

CodeCrosser creates a file in which all procedures are mentioned that are used in your project. It shows in which sub or function (of whatever module) it is called. It is usefull in debugging and streamlining your project.

Procedures in forms are searched for in the form itself.

Procedures in all other modules are searched for in all files of the project.

CodeCrosser creates an Ascii-file with the extension XFR in the Copycode directory. You can load this file in Copycode (provided that the size is under 32Kb.

You can find CodeCrosser in the Options menu from the Copycode main window.

See also: Problems


Loading Files

After choosing the File-Open command (either from the menu or by clicking the FileOpen icon) the Windows common open file dialog appears. Standard file-extensions are *.MAK, *.BAS and *.FRM. By choosing a *.MAK file you open all relevant *.BAS and *.FRM files.

You can also open *.FRX files. In this case Copycode reads the information from the FRX file.

You can also open a file from the recent-files menu within the File-menu. Copycode remembers the last 4 projects/files you opened. These files are read from the Copycode.ini file (in your Windows subdirectory).

After opening all relevant files, the source code of the first procedure is shown in its window.

BTW:

for Copycode to work properly, you must to save all VB source files as Ascii files. Only then will Copycode read the file. You can save these files from the VB File - Save As menu, by checking the Save As Text checkbox. Once a file is saved as an Ascii file, you do not have to worry about it anymore.

Also choose Save as Text as the default option for VB. You may find this option under Options - Environment - Default Save As Format - choose Text instead of Binary. After that all new files are saved as Ascii as standard and all graphics forms information is saved in *.FRX files.


Source window

All source code is shown in the edit window. In this window you can use a Quick menu to access the options from the Edit menu a bit faster.

You can Select all text, Copy, Cut and Paste text in this editor.

There is just one limit to the size of the text:

The editor is a regular multiline VB Textbox, so only 32 Kb of text is allowed in the editor. There are, however, as much textboxes available as the project has files and even more code is available fromthe listboxes.


Copy, Cut and Paste
Cut 'N Paste

Just like all Windows programs Cut, Copy and Paste can be chosen from the Edit menu or by clicking one of the icons in the buttonbar (only when a file is available).

There is no Save-file option, so you can only use Paste and Copy for reorganising your files prior to copying a large amount of code.

Once in a sourcecode window, you can reach a quick-menu by pressing the righthand mouse button, which allows for cut, copy, paste and Select all Text actions. Choose Select all text and then Copy to copy all of the procedure.


Finding Text

There is a Find text option (within the Edit menu). After pressing the Find-button in the Find-window, Copycode will show a listbox with all the procedures that contain the text you're looking for.

Double-clicking on one of these routines lets you see the procedure. The text you searched for is highlighted. You can of course select all text and copy and paste the text, these functions are available form the edit menu in the find window.

By keeping open the listbox containing the referenced text after double_clicking a line, you can access multiple instances of the text.


Procedure listboxes

The procedure listboxes are shown in the main window.

Copycode mode:

From these listboxes you can choose the procedure that you wish to see. In the lefthand listbox all event driven procedures (coupled to VB objects) are shown.

In the righthand one all user created procedures are shown.

Spy:FRX mode:

In these listboxes the names of graphics are shown. The lefthand listbox shows all BMP and WMF type graphics. The righthand listbox shows all Icons (including Form-Icons).


Project Information

Copycode shows:

Project information: shows statistical information about your project. The indicated number of Constants and delarations shows a question mark unless you run CodeAdvisor. The indicated number of Lines of Code does not count the number of blank lines.

The Make-file: You guessed it

About...: Copyright information and registration details.

This information is available form the File-menu in the main screen.


Closing Copycode

You can close Copycode by choosing Close from the File-menu in the main screen. You can of course unload Copycode in the regular Windows fashion.


Screen layout
Fonts and Colors

VB doesn't offer it, Copycode does: the option to change the font and color in a child window. By choosing a small font, you can view more code on a line.

Choose Font or Color from the Options menu and play for a while.

Check All Windows from this menu prior to choosing a font or color to change the font and / or color in all windows in one go.

Sorry Copycode can't show colorcoded reserved words highlighted like VB, but where are we without anything to wish for.


Screen positioning

You can decide where Copycode is to be positioned on screen. Once Copycode is at the desired place choose Set Position from the Options menu in the main window.

The screen coordinates are written in the Copycode.ini file in your Windows directory.


Installing Copycode
Installing

In order to use Copycode you do need to have:

VBRUN300.DLL (not included, as it belongs to VB 3.0)

CMDIALOG.VBX (not included)

COMMDLG.DLL (not included)

in your \windows\system directory or in the directory that contains Copycode.exe.

Copycode creates a .INI file in your \windows directory (it contains the 4 most recent files you edited in Copycode, screen position and registration information when registered).


CopyCode Limits

Copycode has a limit of 32 Kb per procedure (due to the limit for VB Text-boxes) and a limit of 60 Kb for the global declarations area of any form or module (due to a built-in limit in Copycode. Visual Basic allows for 64Kb).

I have looked at several possibilities for removing the 32K limitations, but using other controls / editors results in blowing up the used resources and degrading performance.


Thanx
Thanks

Several Code Copyiers deserve thanks for their support and ideas. So, thanks to:

Bradley O'Keefe

Guy Verville

Chris Velazquez

Larry Rebich

Joe Kane

Also, of course, thanks to MicroSoft for creating Visual Basic and not including Copycode!


About Copycode
About Copycode and Disclaimer

DISCLAIMER AND AGREEMENT

Users of Copycode must accept this disclaimer of warranty. If you do not accept this disclaimer, do not use the program.

COPYCODE IS SUPPLIED AS IS. THE AUTHOR DISCLAIMS ALL WARRANTIES,

EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THE WARRANTIES OF MERCHANTABILITY AND OF FITNESS FOR ANY PURPOSE. THE AUTHOR ASSUMES NO LIABILITY FOR DAMAGES, DIRECT OR CONSEQUENTIAL, WHICH MAY RESULT FROM THE USE OF COPYCODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

THE LICENCE AGREEMENT AND WARRANTY SHALL BE CONSTRUED, INTERPRETED AND GOVERNED BY THE LAWS OF THE NETHERLANDS. YOU MAY HAVE OTHER RIGHTS WHICH VARY FROM ONE STATE TO ANOTHER.

Any person or organisation wanting to distribute COPYCODE for profit must first contact the author by post or email for authorisation.

Copyright for this software remains the property of:

André Koot

Compuserve address 100120,2360


Help Magician

This helpfile was created using the Help Magician, a tool by Software Interphase Inc. This tool provides extremely easy editing of helpfiles. No more need for an RTF-file editor and hard to learn tricks.


Registering Copycode

Copycode is shareware, and is provided at no charge to users for evaluation. Feel free to share it with your friends and colleagues, but please do not give it away altered or as part of another system. The essence of shareware software is to provide computer users with quality software without high prices, and at the same time to provide incentive for programmers to continue to develop new products.

If you find Copycode useful, and you are continuing to use it after the trial period of 60 days, you must make a registration payment as indicated in this section of this document. In return you will be given a user name, serial number and access code to disable the shareware reminder. This information will be good for all future shareware releases of Copycode. You will be informed when such releases become available.

To register your copy of Copycode send your name and address plus either a Cheque on an Dutch or English bank, Postgiro, Postal Order or International Money Order for the required sum, made payable to:

André Koot

Jan Nieuwenhuyzenstraat 54

4818 RK  Breda

The Netherlands

Pricing for Copycode is:

25 dutch guilders

10 english pounds

15 american dollars

for each and every copy

You may register Copycode through Compuserve in the SWREG forum: type Go SWREG and register ID 3357.

After registration is confirmed, you will be sent a serial number for Copycode and an access code via E-Mail. Enter these with your name in the registration form that is available from the About box in Copycode. These data will be written to the Copycode.ini file in your windows directory.

Please allow for 2 weeks delivery of the codes after registering.


CodeProblems

Two of the Copycode functions (CodeAdvisor and CodeCrosser) need to analyse your source code. They are not the most advanced in the world, so you may find this error:

Suppose your project contains a form with these procedures:

Sub testme (x as text)

Sub testmeproc (hello as integer)

CodeAdvisor may not report 'testme' as useless while it is never called, it will find testmeproc and assume that testme is needed.

CodeCrosser will announce 'testme' to be called by 'testmeproc' even when it is not called by Sub testmeproc.

So:

Don't trust this program for 100%, use your own judgement...

See also: Limits


Optimize

In most cases not all procedures and declared variables are really used. These data do cost a lot of resources. Removing this code could result in smaller executables.


Ascii

Visual Basic can save all source code as Ascii text. This code can thus be read by several utilities and edited using normal editors. Copycode needs this file format..


Global search

You can search for any text string in the project you opened in CopyCode


Quick menu

By pressing the right hand mouse button a quick menu appears. This menu offers the same options as the normal menus


Aboutbox
About copycode...

Copycode Copyright by André Koot, 1994


WMF's

Windows Meta File is a universal graphics file format for use within the MS Windows environment.


BMP's

BMP stands for BitMaP graphic. Every dot of the graphic is presented by its own bits.


FRX file format

FRX files are created when VB saves forms as ASCII code. These files contain all graphics information. You cannot normally read these files, but Spy:FRX enables you to look into them and copy the information.


RTF file format popup
RTF file format

The Rich Text Format was created by Microsoft to allow for exchanging text files on different platforms. Also it is used for creating Windows Helpfiles using the Microsoft Help Compiler.


XRef popup
Cross Reference

A cross reference shows all procedures (subs and functions) that are related to each other, i.e. by which sub or function a specific procedure is called.